tf: added "if", fixed compiler to correctly compile function names, minor fixes and optimizations