Quantum computers, which process information encoded in quantum mechanical systems, hold the potential to solve some of the hardest computational problems. A substantial obstacle for the further development of quantum computers is the fact that the lifetime of quantum information is usually too short to allow practical computation. A promising method for increasing the lifetime, known as dynamical decoupling (DD), consists of applying a periodic series of inversion pulses to the quantum bits. In the present review, we give an overview of this technique and compare different pulse sequences proposed earlier. We show that pulse imperfections, which are always present in experimental implementations, limit the performance of DD. The loss of coherence due to the accumulation of pulse errors can even exceed the perturbation from the environment. This effect can be largely eliminated by a judicious design of pulses and sequences. The corresponding sequences are largely immune to pulse imperfections and provide an increase of the coherence time of the system by several orders of magnitude.