Add mode set funtion