Refactored to classes