Refactor

Makes it easier to add new key types in the future