General highlighting implementation, moved to its own files