further debugging of function