Logic & commenting (new version)

Commented logic for first half of code