Refactor tests as well