split update in two versions, since first part was already in use
refactored and fixed handling of context menu