Refactor MovingObject class.