edited version of ui.R