refactoring smelly code