changes from Seb's code review