improving and adding error messages