refactor things a bit