reformat according to rules