Fixed and refactored some tests.