refactor rootviewcontroller handling