added popup code and background code