updated to support debug keys as well