refactor regular.py