added getKeyCount and locate functionality