trying to explain approach with some pseudocodesince time is up