Refactor UI into templated modules