feature/logic out of templates