Modularize core logic.