parser.py optimized and cleaned