Check this logic.