Fixes, space optimization, better error handling.