fixed various bounds calculations and various other style issues