natural log added and "main" improved