minor code tidyups