slight refactor