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

This reverts commit 664d207bbd0a13f1e316f591fade82a8470aaaeb.
Revert "Revert "Cleaned up more repetition with new functions get-vx and get-vy}""

This reverts commit ec3c1d20e49d98f36388e66b23ede2e05358cf0a.