update to sw function