added debug mode, and cleaned up the magmi loader