Enhancement support rectangular

Fixes for #238 , #194 and performance improvements.