Completed the assignment and added complete code