logic for creating table view and cells