Refactor tests a little bit