Update the code so it is possible to implment unit tests.