Fix up rest of the code