Removed redunant code and unnecessary lines.