Cleaned up grav code