Overcoming the "script exceeded maximum execution time" error