added forEachkey method

tidied comments