Cakeresqueshell optimizations.

DRY when building libraries paths.
Do calculations outside the workers loop. Minor optimizations.