added some controller logic and updated the view