merge with some change in popup window behaviour