Code cleanup and ts fix
Merge pull request #7 from colemanw/cleanup

Code cleanup and ts fix