added tlib
updated to use proper comments