added support for complex shapes