Breaking the big function up to modules