Functions and keyboard compatibility

- Keyboard movements now kinda work
- Turned a few things into functions