This is the first version of my implementation with the code completed