Working version of assignment 2