added detailed comments when exceptions occurred