refactor a litte