Fixed some bugs and added piping.