Improving performance a bit.. (from 180 seconds to 106 seconds)