Merge branch

Merge in changes with latest version of simov's code.