Added the fixes from Nick