Refactoring to tests.
Converting main methods to tests.