Translate merge

Bug fixes, minor improvements and refactoring, all intended to make the translator more stable and to handle errors and exceptions better.