slight refactoring and cosmetics