Debugged previous code. Also now the interactive version does the necessary calculations. MUCH faster