Improved comments also tried to reduce branching