Added holdLatch and releaseLatch functions