Full working hand in, with tidy code