improve autoload function snippet