Refactor acceptance and unit tests