refactoring + added support for other loaders + better caching