Fixed error construction and format. Renamed vars for clarity and conformity.