add some comments, simplification, replacing auto :) and something else