Changed the code for initTFControl to a nested javascript, It is easier to read