Finish and tidy code