Fixed formatting of tray code and behaviour of context menu