Fixes the entire old logic and adds missing pieces of logic implementation. Adds comments everywhere. Fixes all yellow flags in codePro