more refactoring, inlining