update factory method to anonymous self executing method