Filled out solution for assignment