updated inlined code