Modularize code