working - minor refactor