Fixed to many var statement and missing semicolon errors