added search for pipes, moving to function