Added metadata and logging which connects to the metadata. Also some
changes to the library. Login attempts now returns a LoginResult object.