Adjusting and refactoring sen.py