some minor refactoring still