add error message
removed unused variables