Improvements to pipeline.

There may be some inefficiencies/room for improvement, but premature optimization and all that.