refactor the commits.py