added utility functions and refactored loaders