Move charset to a variable; minor cleanup