Fix a whole lot of issues