final bug fixes to preliminary version of improved grid algorithm