move code to def pipe