refactor, slightly