Refactor tests and remove some unused methods