refactored the load functions