making a proper "else-if" statement in handler instead of bunch of ifs, so that type is not checked without need