Refactor of test