made various fixes to sliding window script