various additions and fixes