added setHandler function