Improved handling of nested quotes