Changes as suggested by Will's code review