Many important changes to the backend.

Missing: frontent and script for terminating node
(backend functions are ready)