Conversion refactoring, formatting and tidying up.