Functional programming added, nested if logics are optimized

Comment From: bclozel

Thanks for your enthusiasm but we would rather apply cosmetic changes ourselves. We value community contributions but we would rather have them on actual bugs, documentation and enhancements.

Keep an eye on "ideal for contribution" issues.