Refactored parse.py