Added more tests and made some fixes based on their failures.