Parameter tuning and better error reporting