How did you end up using this logic?