minor code tidies based on code review from sam