Updated paste
More descriptive variable names
Handle cases where element has no class, or match returns null
Ensure selection remains after colorization