Corrected and added tests.