added better support for reading keys