Webapp big refactor

#348