splitting up logic