Refactored so that app is configured properly.