Refactors hot key listener function
Improves formatting of docstrings