incorporating @svevangs suggestions