Minor refactoring and delete the unused test