added some controller logic.