added logic to correct word