Rearranged the Google test and fixed some bugs.