Working, but I'm tired, so this needs to be redone as a module.
missed a debug