Parser logic and performance improved