General clean up

made things a bit neater and more readable (hopefully)