Scope variables!
Add some comments and some code cleanup