Assignemnt 2 with some minor adjustments