add missing #include
minor refactoring