Refactor to use view name instead of view id

NOTE still need some testing