cleaned up code and added smooth movement