Improved and simplified parser