modularized code and updated ReadMe