Implemented centered squares helper (hopefully with caching).