Rubocop

do not merge yet, just source for discussion.
but maybe even better to use each_with_object, but it is old code, so I do not tune it too much :)