Tidies up output. Closes #13
Extracts controller logic into seperate library. Closes #16