Partial refactoring, REST API and testing

This commit is meant to introduce more order in the server codebase,
but some changes have been made to the dashboard as well. It should not
introduce functional changes.