Cleaned up a bit, added underscores to SQL function names, and added a minor check in the saveReport function.