Speed stuff up by moving prepare out of loop