Implemented loading

And a number of other fixes