Fixed so everything works, Ieuans code not yet included, need varification.