Refatoring and implementing new tests.