refactor, small performance improv