separated out keys and merged in homegrown key handling