optimise Plug.select method