Get rid of push loop
Implement basic templating
Refactor templating functions
Change templating to support seperate templates for results and selection