Merge code

we merged the 2 codes together and debug it