Add `prehook` and `posthook` options

- Rename `key_map` to `aliases`
- Rename `key_prefix` to `prefix`
- Internal clean up