now supports passing in objects