Refactor tests to speed up execution