more sophisticated pgrep approach