Finished porting basic-block, not sure if the api is right