improved chunk processing

Added chunk processing to limit the number of bytes read. Added width handling
for formatting chunks.
added left trim and moved avltree to defs

Added left trim function. Moved AVL tree definitions to a separate definitions
file for use in other internal files.