Changes made to source code to convert to tf package. Some general
clean up of the code was done as well.