If applying centerImage to the same image twice, do not destroy the entire class attribute. Only remove class names that would have been added by centerImage function.