Refactored get Class method