Cleaned up some code repetition by creating two new functions set-vx and set-vy