Deriving: cleaning and better error msgs