Changes as per Dave's code review