minor fix, minor refactoring