Implementation of main code for tests