Refactor + new tests + a more general trait