added polimorphism, detecting class types