Refactor inline function