Modularized Main Code