optimize browse widget code