refactoring
support for varcharmax