Added gravity algo.  Slight design tweaks.