Port latest bug-fixes and parsing improvements to branch