Refactor and code reusse.

- Add group definition
- Use macros to dynamically create functions
- Modify default keybindings