More comments and better coding; Import clogb2 funciton.