Tidy up as well as possible for now

Some changes still to make, e.g. variable names and
length of functions/number of variables, but egregious
problems are resolved.
Merge pull request #4 from StevenMaude/pep8ify

Tidy up as well as possible for now