Changed most get_class calls to instanceof for better readability