Modularize the stuff. Also: TESTS!
Return nil when passed doc to parse is nil as well