Made function_exists and event_exists optimized functions.