add pretty much all the code