InferSchema, cleanup, library headers

Address #189 except it doesn't do client queuing.. will make a separate issue.