made output slightly better and corrected variable misspelling.