even more refactoring, fixed delete popup bug