bit of refactor