Presence refactor

this is only one step out of many into reducing the code complexity.

- remote_manager is still there because it is used in the API O_o
- there are still some changes missing, for example, the initialization is not fully working and the system does not behave well if an instance crashes (timeouts).