code for computing all modes
rendering of modes
now computes correct modes
working code