Fix errors and formatting code.