some cleanup-related refactoring; starting to prototype loading apps