Add try/catch for error loging