Separate Daemon mode from GUI and refactor both.
Separate Daemon mode from GUI and refactor both.