Moved function to separate files.