Several improvements and refactorings Iteration 8. Slightly improved pop-up.