Refactored out into separate classes