Improved expression parsing and handling