Add settings for command-frequency.  Minor refactorings