This is the original code I wrote.