main code work