Code actually does work, false alarm. Output matches that of the original. Fixed some comments.