Unglobalized variables.
Tried to make script more script and less confused HTML.