Redid lots of code