Error Check added