Reduce constructor and enclose it in an IIFE.