switch func building