Save message in postgresql
Style and script improvements