Cleaned up code and formalized homework example.