Refactored detail tableview related code.