Refactores tests and factories