Correcting implementation, corrected tests.