setup of most the UI stuff, some template functions are there