Tidied up loader.py