restructure app and add the three endpoints