Added class_exists check