Added logic to support backward and forward compatibility for various keyboard ID formats.