Got tt's working in core lib
More crazy ass refactoring.