Minor changes (refactoring and cleaning)