Finished the code