minor code tidyup