modularized code further