So here are my fixes and their sources just in case you need further explanation as to why it works. Chances are I won't fully understand all of the changes but first things first - get the code to build.
A friend of mine who works in security recommended this book. He may have also mentioned something about the CTO having read it and like it. And, to keep up with the jargon I knew was coming round the bend I figured I needed to read this lovely trope. But it was way better than I expected.