Major revamp!

Kevin - this needs a good look. I won't feel bothered if you disregard it all!

Basically I can't see me tweaking this much more so figured I should do a PR..

Notes:
- Need to double check the text is getting bibtexed correctly
- Need to look at cgi. I can't for the life of me work out how your code worked (the original I couldn't get to work..) - like, how is outputting the saved bibtex file to the user? I may have deleted something..
- Most of the Latex stuff is removed in the script and cgi. Shouldn't take long to get it working..(the main code I could find is in libthing.csv) Just realised that it wasn't actually being used in the current version so didn't focus on it
- I may have over-simplified some parts - and some parts are downright un-pythony.. I question the naming of functions and files..

All the best
Will