a little bit of refactor