Rather than using a separate bool to indicate whether the program is initialized, you should be able to use isLinked.