moving some logic