I think that Janine and Moriarty and Magnussen are connected. When Moriarty was in custody and Mycroft shared details about his early life etc he probably mentioned Sherlocks dog. (I believe the dog was an important reason as to why Sherlock is the way he is) Moriarity shared his knowledge of Sherlocks early life with Magnussen. How else would Magnussen know these details or had they already been released into the public eye by Moriarity?
Perhaps Moriarty has a twin ’ I’m soooo changeable’ or it was just in fact a video and he is actually dead. Videos which were arranged to be put in place when and if Magnussen died.
Why was Sherlocks mom’s math book mentioned? I think this will be important in the future.