more refactoring and delinting