My solution to assignment2