Refactoring code after 4