Homework #1 with fixed bugs.