Updated to comply with pchote's suggestions