Refactored into separate classes