refactor. extracted global function to assign ssr role
removed code which isn't really useful
bugfix in path