Reorg of logic into files and some code cleanup. Preping up for adding time based theme switching