added all the previous code