codes from shiny app