Optimized polymorphism usage, removed unused parts.