runtime functions refactory