refactor, more object oriented