added insert function. defined maxKeyCount in functions