Ok, I implemented most of your suggestions in 29567562ec9e4dfa61767123ddd8ce910d79c779.