Added support for maxWidth and maxHeight