refactor a bit to address feedback