Added esgfFlag for debugging purposes