Here is the Pseudo code, look over it and fix it because it made little sense to me