Clean a bit and add some error messages