Removing unsued variables and corrected indentation of code