updated to handle classes