improve coding and add slider