Ok, this is still kinda big, but at least it doesn't spew warnings and actually works correctly