Cleanup add_key
Remove some useless comments, the code documents it enough
use map instead of holding a temp array