merged all the code