implemented Tom's suggestions