Refactored and added cancel button using message passing to background page