Code now works properly, and the assignment is finished.