fix optional parameters and implement callbacks

issues #13