Refactoring, comenting and formating code