Fixed version stuff
Improved error messages and regained some performance.