changes made:

color
reformat to my usual formats
added a way to count the number of grids x that pass and compute the resultant xblock.

enjoy!