added some bit-shift divide and formatting changes