Fix all performance problems recognised by Codacy.
Merge remote-tracking branch 'origin/master'