commented every line of code with its purpose, tested console logs. console logs outputted as expected