needs ALOT of work, removing pipe for instance, global variables?.