Made checking function more PRO. Thanks to @dorimanx.