minor logic tidy up