added twofactor code and initial if else for servermode