Code cleanup
Remove mutable objects from function args
Use own cache
Optimize quality caching
Standardize cache_key generation
Merge remote-tracking branch 'upstream/develop' into develop