accuracy and speed improvements for grid alignment