Fix several bugs and add complete work flow.