Added header and simplified logic.
Add notes.