Fixed a bug in the cache where a job could be added several times.
Some changing of order of stuff to improve loading speed.