nearly finished popup and modified js