updated and added a load of documentation. Still pretty rough and ready.