move logic to end of file