convert pseudocode into real one but still lot to do