cleaned up LoadFile and added tests