Added a little documentation.
Changed devices to be indentified by type and index instead of their ID when syncing device state.