-some minor refactoring