major code-base refactoring