Reworked structure slightly and prepared for controller switch.