completed the code