move logic to main