implemented some of Marc's suggestions