Refactoring autoloader functionality