Completed the code