Some modifications by Meng, and I added the occupation measurement
trying to merge
Added occupation number measurement