trying to separate some logic