Refactoring and optimization of framework.