Use anonymous function to avoid pollutiong global js namespace