Fixed grammar and corrected some ambiguous statements. Changed some code to bring uniformity in indentation.