factored out common code;
Merge pull request #2 from niksu/sh_issue_factor

factored out common code;