We demonstrate an improved technique for implementing logic circuits in light-sensitive chemical excitable media. The technique makes use of the constant-speed propagation of waves along defined channels in an excitable medium based on the Belousov-Zhabotinsky reaction, along with the mutual annihilation of colliding waves. What distinguishes this work from previous work in this area is that regions where channels meet at a junction can periodically alternate between permitting the propagation of waves and blocking them. These valve-like areas are used to select waves based on the length of time that it takes waves to propagate from one valve to another. In an experimental implementation, the channels which make up the circuit layout are projected by a digital projector connected to a computer. Excitable channels are projected as dark areas, unexcitable regions as light areas. Valves alternate between dark and light: every valve has the same period and phase, with a 50% duty cycle. This scheme can be used to make logic gates based on combinations of OR and AND-NOT operations, with few geometrical constraints. Because there are few geometrical constraints, compact circuits can be implemented. Experimental results from an implementation of a 4-bit input, 2-bit output integer square root circuit are given. This is the most complex logic circuit that has been implemented in BZ excitable media to date.