Refactor tests to make to run properly