Refactor for modularized source