This adds pretty much all the functionality that we wanted