Add comments
Move event handlers to elements.py
Add comments and expand documentation
Add missing re import