Using map to handle commands with func callback