Main function mod