Added a function for checking a class to clean up code