My pseudo code attempts