window open in separate function