more modularized code