Final version of assignment2