refactored to class