separated library from sample code, removed junk from library and minimized its size.