Adding latest code
Fixed merge conflicts