minor modifications from Long