Refactoring the core classes