Detailed modeling of nanocrystal flash memories