cleanup old code, fix some issue when migrating, improve comments in config, etc