Refactored to reduce number of statements in quote state.