refactoring and reformat.