Edited per programming assignment 2.