server.sh: Almost complete restructuring.