gravity logic moved to a common location