Refactor and label tests