Finished - needs some refactoring to put first steps into functions