Fixed logic speed issues