Working version of assignment 5.