Refactor table view