Refactor webapp