Added inline parsing, and cleaned up regex to be more robust