another rectangle version, to test what is easier to understand