Move logic into definition