Updated tablet code