Fixed some authentication bugs, added doc comments for unit test classes