added focus handling