Wisepill integration changes; widget timing logic bugfixes; code cleanup.