WIP Big refactoring of the web application.