major refactoring, full autoloading