update code with patches
refactoring and added tv feature