added .cache as a fallback for $XDG_CACHE_HOME
replaced jobcontrol with wait
reduced lines