move logic out of app