refactor. Fix errors.