Reorganization of Pi2O to keep the database actions in a single thread.  Cleaned up the scheduling loop to make it work a little more smoothly.