Merge Dima's changes into David's repo