Simplify the code using broadcast pending intent