added rudimentary conditional parsing