Improved ground template fitting