Merge earlier changes from bfox with my earlier changes
Merge with fixed branch