Add more browser test coverage and clean up test code