More code cleanup primarily to make methods fault tolerant