Working version of assignment 3