added movement and cleaned up code