code fixes and cleanup
updated lib