Some modifications per matt's comments