added all the code