Code refactor.

Add common.py module to store common functions.
Add jsonify function wich accepts arbitrary number of named or
positional arguments and converts them to json. Start to use this
function instead of json.dumps everywhere.