Bug correction for fault tolerance; code cleanup - Mario