more typos and logic errors