-modifyng algorithme so it works better with squares n stuff