refactored all core files and updated all test coverage