wrote main code