decreases running time from 55 sec to 2.