Incorporate all changes from nathan7/master