several small improvements in performance