some good practices refactoring