Mostly done with this, I think I just have to fix a boolean error.