Funcitons mostly work except add global