Performance optimization: changed processing algorithm.