Finish the first version of the code