refactoring for autoload