move app logic into init