Various fixes

Made quite a number of improvements and put a couple of fixes in place.