Write the angle.

Also added more unit tests. Although they didn't uncover any bugs, theres no point removing any of them.