Added tests, refactored tests for core.