Added debug assertions