Improving parser and adding debug messages