move declarations to top of scope
remove sasl_do_step and fix memory bugs
nicer formatting for SASL exceptions
added some more error checking