Added local scoping for all variables outside the app object