output parser refactoring and fixing non-nil return if error pointer not supplied