Cleanup of core and added self tester
Documentation update