adding some ideas with pseudocode