Finished refactoring into classes