cleaned up and documented the loader