Minor refactor and filled a gap in tests