working version with 2 intents