Move shared functions to autoload