Put back changes I already made and a few fixes