Refactor UI framework to enable integration of E4 code