Refactor of bloat into templates