Clean up & better error reporting