pipe detection from bottom; removed dependency