improved ticks algorithm