Reorganize library and add oauth authentication.