Work on issues with REST API and DI

Fixes a few issues caused by incorrect usage of the DI framework,
restores socket notification mechanism, does some cleanup.