fixed some passings of objects

also added rudimentary api
fixed merge problem