Used proper function to switch between windows