refactored code into three smaller modules
broke down create_key utility function into parts