added SH function code