Made changes according to carl's comments