Self initializing function