minor refactor/optimization