First commit. Added some code written previously. Seriously needs cleaning up and commenting!