Added suggestions from sounder_michael on stack overflow.