sync with reports branch code
reformatting code