Theorem 5 - code. Forgot to add the src files..