More work on seperating out code into classes