Added set_time_limit() call to prevent script from stopping when maximum execution time is reached