Restructure client code to hide frontend inside UI/
Fix the lack of waiting for the frontend thread