Add main.
Add server.
Fix bugs.