Get last value of variable - probably to be abstracted