refactor a little