added comments to hopefully keep things clear
changed function name