Grouping logic in one class to make it cleaner and reuse some code.
Depends on: D8604
Build iOS and Android and play with threads to make sure functionality still works.
fix commit
rebase