Solution submitted for assignment 2