Incorporate all changes from nathan7