added support for different key type