Several bug-fixes, ready to port to C++?
Merge remote branch 'origin'