Merged two functions that were stupidly separated (#111)
Also cleaned up a bit
Merge branch 'dev-pipes' into dev