Rebuilt for better error messages