Split up OpenWindow input code into its own function