Update convertSpacesToTabs to remove excess spaces