Using dispatch_once function instead of the static bool values

Removed the 'static BOOL initialized' instead have added the dispatch_once function, which is same and is executed once.