refactored to objects