removed unused codelines and performance improvements