This also improves some logging and adds discreet try-catch blocks for each function call which improves diagnostics