Apache master merge

Merged apache master and handle merge conflicts.
I don't believe this is the correct version