added trim flag for parsing