Added function and fixed existing.