Code style improved, make use of IIFE.