did some minor refactoring