Implementing test.
Refactored.