draft of moving window code