Code amended for debugging.