Started refactoring into separate classes.