Better isFunction method