improved unit and e2e tests