fixed style for back-end code. Refactored code. Handled bad inputs and errors. Basically changed everything, I'm a boss.
fixed code review changes
Merge pull request #39 from dcs24/master

Tidy up back-end code