Fixed typos, added more echo statements for clarity.