deleting trailing whitespace
adding proper match class names and logic