Made more efficient so it hasn't got to keep searching through arrays.