added logic for app