minor refactor per Roy's suggestion