better parsing and other improvements