Better coordinate generation, but what a mess!