Separated window functions and main program