Improve error handling and add client joining