Combined two styles: pattern-matching vs if-then-else

Pattern matching (from book), if-then-else (from original code)
Changed code to accommodate 'Null' trees
Removed unnecessary code

'valid' is neither mentioned in the book nor anywhere else in the code
Modified code to accommodate 'Null' trees