Prepare function for contextmenu