refactored into class