Restructured web backend to run as a separate thread, still WIP