move all functions into tiFile class
modify to make use of changes to tiFile class
update code documentation
resolve issues with newlines
add documentation for tiFile class