Lots of bugfixes. Updated docs. Some dependencies refined.