Refactored into seperate classes