Cleaned code and added support for #var-values in json.