several additions and fixes