Assignment 5: Changes to make the code more generic.