Refactored the loader