added part of algorithm as comments to newBackgroune