refactored code to load initial apps and add apps