Added rectangle recognition