refactor key conversion functions into own module