use sql database for server; some more style changes