Lots of code that I have been too lazy to post