make it work for multiple keys of the same type