minor refactoring
switched to span class
fixed match function