inlining critical functions