Tested circuit with correct functionality and increased clock rate to 50Hz (reliable)
Max frequency before errors is about 70Hz before relays cannot mechanically switch in time