Finalized solution for part1 of project