using function map for setting switch