implementing some of the code