Added c function to get stack to switch to