need to debug retangle implementation to prevent infinity output (div by 0???)