Added better diagnostics