1. some minor refactoring