a bit of refactor