This self-executing function seems a little odd and could probably be written better. Sorry for the vagueness of this comment.  If you want me to provide some suggestions I can.