Move app code to separate file