fix counting bolt, implement window sliding