Moved a function out of _internal