Changed main code