Clean up code

Cleaning up code and creating a run command for later use as a go routine.