optimized the in tableView:didSelectRowAtIndexPath method