More functions

Moved more code into functions

Set code up for easy drop in of functions allowing me to add in display
board function tomorrow