Improved memory management and exception safety. Version number is loaded from VERSION.txt.