refactor lab1problem1 templating