Refactor tests to be more efficient