Major refactoring of architecture