Start on math code
A bit of reorganisation