Fixed issues raised by Jake's code review