trying to troubleshoot sub-routine