Corrected two errors. Seems to have one more (very rare) error.