Removed unnecessary code, collapsed multiple var-statements.