Loads of work on the research stuff

also added (hopefully) functional saving and loading
and fixed a gadzillion bugs