Accidentally deleted a bunch of code on merge, adding it back now.