! code cleaning and refactoring