make it possible to pass a block when create an instance