Added unloading. It is untested.
Lots of testing and twiddling.