Start of a server mode.

Also fixed some formatting.