Refactor builtin functions