2nd attempt at set gravity code