move window splitting functions into a separate file