Stop using a common variable throught the code as it is not being captured by the blocks which keeps causing issues