Refactoring runs.php