change some functions

use 'case' to select from different components