many comments added
modularization finished - testing pending