Raise appropriate error for unbound variable; add comments
Formatting