simplyfy wesnothd code.