refactor a lil bit