dont allow empty input
added templatized mode switch