Yes I know, this duplicated code should go sometime.