modularized and optimized