Changed code after a second review from Simon