add class_exists check. Will close #4