Updated parser with shorter python code