pull updates from patty

This pull request is to merge Patty's recent updates into nightscout's version.