Serialising the db now works.

also added flags for setting port on server