major refactoring on the framework