refactoring ...
move modes into separate files in modes/, refactor settings into config
fix some bugs just caused by prev commit