Refactor and implement autoload