finished with pseudocode