Extrated creating handlers to separate function